/**
 * @file elevation.h
 *
 */
#ifndef ELEVATION_H
#define ELEVATION_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
 *      INCLUDES
 *********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lvgl.h"
#include "lv_watch_conf.h"
#else
#include "../../../lvgl/lvgl.h"
#include "../../../lv_watch_conf.h"
#endif
#if USE_LV_WATCH_ELEVATION != 0
/*********************
 *      DEFINES
 *********************/
#define ELEVATION_TEST 1
#if LV_WATCH_SIMULATOR_360 == 1
#define ELEVATION_W 240
#define ELEVATION_HOR 100
#else
#define ELEVATION_W 130
#define ELEVATION_HOR 80
#endif

#define ELEVATION_Y_BASE 80
#define ELEVATION_UPDATE_PERIOD 10

#define ELEVATION_DEF_ANGLE              5000
#define ELEVATION_CIRCLE_START           340
#define ELEVATION_CIRCLE_END             3300
#define ELEVATION_CIRCLE_R               100
#define ELEVATION_CIRCLE_R_OFFSET        1
#define ELEVATION_GOAL_STEP              9600
#define PRESSURE_GOAL_STEP               800

/**********************
 *      TYPEDEFS
 **********************/
/**********************
 * GLOBAL PROTOTYPES
 **********************/
typedef struct
{
    lv_obj_t * elevation_canvas;
    lv_obj_t * current_rate;
    lv_obj_t * elevation_goal;
    lv_obj_t * highest_rate;
    lv_obj_t * lowest_rate;
    lv_obj_t * highest_dot;
    lv_obj_t * lowest_dot;
} elevation_ext_t;

typedef struct
{
    lv_obj_t * pressure_canvas;
    lv_obj_t * current_rate;
    lv_obj_t * pressure_goal;
    lv_obj_t * highest_rate;
    lv_obj_t * lowest_rate;
    lv_obj_t * highest_dot;
    lv_obj_t * lowest_dot;
} pressure_ext_t;

typedef struct
{
    lv_watch_activity_ext_t activity_obj;
    /*New data for this type */
    elevation_ext_t elevation_ext;
    pressure_ext_t pressure_ext;
} lv_elevation_obj_ext_t;

typedef struct
{
    uint16_t current_x;
    uint16_t highest_x;
    uint16_t lowest_x;
} elevation_mng_t;

typedef struct
{
    uint16_t current_x;
    uint16_t highest_x;
    uint16_t lowest_x;
} pressure_mng_t;

typedef struct
{
    lv_tileview_ext_t old_ext;
} lv_elevation_drop_pull_obj_ext_t;

#if USE_LV_WATCH_LAUNCHER2 != 0
typedef struct
{
    lv_cont_ext_t cont_ext;
    pressure_ext_t pressure_ext;
} lv_launcher_pressure_tab_ext_t;
void pressure_create_tab(lv_obj_t * par);
#endif

lv_elevation_obj_ext_t * elevation_pressure_get_ext(void);
lv_obj_t * elevation_pressure_tileview_add_tile(lv_obj_t * tileview, uint16_t id);
void elevation_add_axis_x(lv_obj_t * par, lv_obj_t * align_obj);
lv_obj_t * pressure_create(lv_obj_t * tileview, uint16_t id);
void elevation_pressure_create_event_cb(lv_obj_t * btn, lv_event_t e);
/**********************
 *      MACROS
 **********************/
#endif /*USE_LV_WATCH_SLEEP*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*SLEEP_H*/
